# If SystemC is not installed, download and install it
if [ ! -d "/opt/systemc-3.0.1" ]; then
    echo "SystemC not found, installing SystemC..."
    wget https://github.com/accellera-official/systemc/archive/refs/tags/3.0.1.tar.gz
    tar -xvzf 3.0.1.tar.gz
    cd systemc-3.0.1
    mkdir build
    cd build
    cmake -DCMAKE_INSTALL_PREFIX=/opt/systemc-3.0.1 ..
    make -j`nproc`
    sudo make install
    cd ../..
    rm -rf systemc-3.0.1 3.0.1.tar.gz
fi

# Set environment variables for SystemC
echo "Setting up SystemC environment variables..."
export C_INCLUDE_PATH=$C_INCLUDE_PATH:/opt/systemc-3.0.1/include
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/opt/systemc-3.0.1/include
export LIBRARY_PATH=$LIBRARY_PATH:/opt/systemc-3.0.1/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/systemc-3.0.1/lib

echo "SystemC environment activated."
# source systemc.sh
